package com.lab.network.proxy;

import com.lab.network.model.IProxyCallback;

import java.util.HashMap;
import java.util.Map;

/**
 * 用于构建apiproxy和apiproxy的result
 * Created by MiJack on 2015/11/20.
 */
public class ApiProxyBuilder {
    Map<String, IProxyCallback> map;

    public ApiProxyBuilder() {
        map = new HashMap<>();
    }

    public ApiProxy build() {
        ProxyCallBackImpl impl = new ProxyCallBackImpl(map);
        ApiProxy apiProxy = new ApiProxy(impl);
        return apiProxy;
    }

    public ApiProxyBuilder addApiCallBack(String api, IProxyCallback callback) {
        map.put(api, callback);
        return this;
    }

    public static ApiProxyBuilder getBuilder() {
        ApiProxyBuilder builder = new ApiProxyBuilder();
        return builder;
    }

}
